
from typing import List
class Solution:
    def luckyNumbers (self, matrix: List[List[int]]) -> List[int]:
        # min_m = []
        res = []
        m = len(matrix)
        if not m:
            return []

        n = len(matrix[0])
        if n == 0:
            return []


        for x, i in enumerate(matrix):
            min_m = min(i)
            for y, j in enumerate(i):
                print(i)
                if min_m == j:
                    # 判断是不是在列上也最大
                    max_n = j
                    for z in range(m):
                        max_n = max(max_n, matrix[z][y])
                    if max_n == j:
                        res.append(j)
        return res

       
def test():
    matrix = [[56216],[63251],[75772],[1945],[27014]]
    r = Solution().luckyNumbers(matrix)
    assert r == [75772]

# matrix = [[3, 7, 8], [9, 11, 13], [15, 16, 17]]
matrix = [[4]]
r = Solution().luckyNumbers(matrix)
print("r=",r)